package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/09/08 10:07
 **/
public class Day6_3_Num122_MaxProfit {
    class Solution {
        public int maxProfit(int[] prices) {
            int sum = 0;
            for(int i = 1; i < prices.length; ++i){
                if(prices[i] > prices[i-1])
                    sum += (prices[i]-prices[i-1]);
            }
            return sum;
        }
    }
}